import { EAlnumType } from './../enums/common.enum';
import { PageDto } from 'src/dto/common.dto';
import { IsString, IsArray, IsNumber } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class GetPicListDto extends PageDto {
  @IsString()
  @ApiProperty({ description: '关键字' })
  keyword?: string;
  @IsArray()
  @ApiProperty({ description: '分类id' })
  classify?: number[];
}

export class CreatePicDto {
  @IsString()
  @ApiProperty({ description: '图片名' })
  pic_name: string;
  @IsString()
  @ApiProperty({ description: '图片地址' })
  img_url: string;
  @ApiProperty({ description: '图片信息' })
  img_info: string;
  @IsString()
  @ApiProperty({ description: '作者' })
  author: string;
  @IsArray()
  @ApiProperty({ description: '分类' })
  classify: number[];
  @IsNumber()
  max_height: number;
  @IsNumber()
  max_width: number;
  @ApiProperty({
    description: 'json字符串 [{width: 100, height: 100}]',
  })
  privide_resolution: string;
}

export class ConfigPicDto extends CreatePicDto {
  @IsNumber()
  id?: number;
}

export class DownloadDto {
  @IsString()
  @ApiProperty({ description: '分辨率' })
  privide_resolution: string;
  @IsNumber()
  @ApiProperty({ description: '图片id' })
  pic_id: number;
}

export class ProductImgDto {
  @IsString()
  @ApiProperty({ description: '地址' })
  img_url: string;
  @IsString()
  @ApiProperty({ description: '分辨率' })
  privide_resolution?: string;
}

export class GetPicsByTypeDto extends PageDto {
  @IsNumber()
  @ApiProperty({ description: '相册类型 分类为1 作者为2' })
  type: EAlnumType;
  @IsNumber()
  @ApiProperty({ description: '分类相册就传分类id，其他相册就传其他id' })
  id: number;
}
